----------------------------------Spell Variables--------------------------------------
SPELL.m_iSpellID = 13013 -- Whatever value you want as long as it doesn't override any other spells' IDs.
SPELL.m_iRange = 1024
SPELL.m_sName = "Shieldbearer Auto Attack 2"
SPELL.m_sToolTip =	[[Swing your weapon
					at the target.]]
SPELL.m_sIcon = "devin/blackbetty/spells/ranger/sicem.jpg"
SPELL.m_iCoolDown = 5
SPELL.m_iManaCost = 0
SPELL.m_bRequiresTarget = true
SPELL.m_iSpellType = SPELLTYPE_MAA_AUTOATTACK
SPELL.m_bRecastWhileCasting = false

---------------------------------------------------------------------------------------

function SPELL:Cast( pl, target )
	local weapon = pl:GetWeapon("weapon_all")
	local target = pl:GetNetworkedEntity("Target")
	local range = self.m_iRange
	print((target:GetPos() - pl.Pet:GetPos()):Length())
	if(target && target:IsValid() && target != pl && target:Health() > 0 && (target:GetPos() - pl.Pet:GetPos()):Length() <= 240 ) then
		local dmginfo = DamageInfo()
			dmginfo:SetDamage( math.random(weapon.MinWeaponDamage, weapon.MaxWeaponDamage) ) 
			dmginfo:SetDamageType( DMG_GENERIC ) 
			dmginfo:SetAttacker( pl.Pet )
		target:TakeDamageInfo( dmginfo )
		target:EmitSound("devin/blackbetty/weapons/GougeTarget.wav", 150, 100+math.random(-10,10))
	end
end




